package com.atguigu.springcloud.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * Created with IntelliJ IDEA.
 * ClassName: RestConfig
 * Package: com.atguigu.springcloud.config
 * Description:
 * User: fzykd
 *
 * @Author: LQH
 * Date: 2023-11-07
 * Time: 15:52
 */

@Configuration
public class RestConfig {
    @Bean
    @LoadBalanced
    public RestTemplate restTemplate() {
        //ribbon结合RestTemplate实现负载均衡一定要加@LoadBalanced
        return new RestTemplate();
    }
}
